package co.com.javeriana.aes.patrones.universalbank.util;

/**
 *
 * @author jonathan
 */
import java.sql.*;

public class ConnectDB {

    private final String URL = "jdbc:mysql://localhost:3306/";
    private final String DATABASE_NAME = "CRM";
    private final String DATABASE_USER = "root";
    private final String DATABASE_PASSWORD = "root";
    private final String DATABASE_DRIVER = "com.mysql.jdbc.Driver";

    private  static ConnectDB instance = new ConnectDB();

    private ConnectDB() {

        try {
            Class.forName(DATABASE_DRIVER);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

    }

    public static ConnectDB getInstance() {
        return instance;
    }

    public Connection getConnection() throws SQLException, ClassNotFoundException {
        Connection con = DriverManager.getConnection(URL + DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
        return con;
    }
}
